import axios from 'axios'
import Cookies from 'js-cookie'
import { get } from "@/utils/http";
import store from "@/store";
export default {
    state: {
        userData: {} //个人数据
    },
    getters: {},
    mutations: {
        exitLogin(state, router) {
            get({ _gp: 'admin', _mt: 'logout' }).then(res => {
                if (200 == res.errno) {
                    ElMessage.success('退出成功')
                    Cookies.remove('token')
                    store.state.tags.tagList = []
                    store.state.userInfo = {}
                    state.userData = {}
                    router.replace('/login')
                }
            })
        }
    },
    actions: {
        exitLogin(context, router) {
            context.commit('exitLogin', router)
        }
    },
}